<template>
  <div>
    <h1>当前count值:{{$store.state.count}}</h1>
    <button @click="add()">+</button>
    <button @click="addn()">+n</button>
    <button @click="addnAsync()">+nAsync</button>
  </div>
</template>

<script>
export default {
  // eslint-disable-next-line vue/multi-word-component-names
  name: "Add",
  data(){
    return{

    }
  },
  methods:{
    add(){
      this.$store.commit('add');
    },
    addn()
    {
      this.$store.commit('addn',3);  //commit触发mutations
    },
    addnAsync()
    {
      this.$store.dispatch('addnAsync',5); //dispatch触发action
    }
  }
}
</script>

<style scoped>

</style>